package demo13;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class demoDate {
    public static void main(String[] args) {
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss");
        System.out.println(now);
        String rs = formatter.format(now);
        String rs2 = now.format(formatter);
        System.out.println(rs);
        System.out.println(rs2);
        System.out.println("===============");
        String str = "2024年11月11日 00:00:00";
        LocalDateTime ldt = LocalDateTime.parse(str, formatter);
        System.out.println(ldt);
        String rs3 = ldt.format(formatter);
        System.out.println(rs3);
    }
}
